import { xuebengApi } from '../index'
import qs from 'qs';

export default {
  // 登录
  login: (data: {
    type: number,
    phone: string
    password: string
  }) =>
    xuebengApi.post('api.login/in', qs.stringify(data), {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }),

  // 提交关键词
  addKeywords: (data: object) =>
    xuebengApi.post('api.auth.mission/addKeywords', qs.stringify(data), {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Api-name': 'wap'
      }
    }),

  // 查询小说列表
  queryNovelList: (data: object) =>
    xuebengApi.get('api.news/getArticleListByParams', {
      params: data,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }),

  // 查询小说列表条件
  queryNovelListFilterData: () =>
    xuebengApi.get('api.news/getFilterData', {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }),

  // 查询小说列表条件
  getArticleById: (id: number) =>
    xuebengApi.get('api.news/getArticleById?id=' + id, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }),
}
